# 含噪声曲线图
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt

# 设置图例字号
mpl.rcParams['legend.fontsize'] = 10

# 方式2：设置三维图形模式
fig = plt.figure("含噪声曲线图")
ax = fig.gca(projection='3d')

# 测试数据
x = np.linspace(-4 * np.pi, 4 * np.pi, 30) 
y = x + np.random.randn(x.shape[-1]) * 2.5
z = x * x 

# 绘制图形
ax.plot(x, y, z, label='parametric curve')

# 画坐标轴
ax.set_xlabel("x")
ax.set_ylabel("y")
ax.set_zlabel("z")

# 显示图例
ax.legend()

# 显示图形
plt.show()